<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增项目管理')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-item-add">
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">项目编码：</label>
                <div class="col-sm-8">
                    <input name="itemCode" class="form-control" type="text" required>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">项目名称：</label>
                <div class="col-sm-8">
                    <input name="itemName" class="form-control" type="text" required>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">供应商：</label>
                <div class="col-sm-8">
                <select id="tenderSupplier" class="form-control">
                    <option th:each="tenderSupplier:${tenderSuppliers}" th:value="${tenderSupplier.supplierId}" th:text="${tenderSupplier.supplierName}"></option>
                </select>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">专家组：</label>
                <div class="col-sm-8">
                    <select id="tenderExpertexpertGroup" class="form-control">
                        <option th:each="tenderExpertexpertGroup:${tenderExpertexpertGroups}" th:value="${tenderExpertexpertGroup.groupId}" th:text="${tenderExpertexpertGroup.groupName}"></option>

                    </select>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">采购方式：</label>
                <div class="col-sm-8">
                    <input name="procurementMethod" class="form-control" type="text" required>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">项目负责人：</label>
                <div class="col-sm-8">
                    <input name="itemLeader" class="form-control" type="text" required>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">显示顺序：</label>
                <div class="col-sm-8">
                    <input name="displayOrder" class="form-control" type="text" required>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">项目描述：</label>
                <div class="col-sm-8">
                    <textarea name="itemDescription" class="form-control" required></textarea>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
    var prefix = ctx + "system/item"
    $("#form-item-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-item-add").serializeArray();
            var supplierId = $.form.selectSelects("tenderSupplier");
            var groupId = $.form.selectSelects("tenderExpertexpertGroup");
            data.push({"name": "supplierId", "value": supplierId});
            data.push({"name": "groupId", "value": groupId});

            $.operate.save(prefix + "/add", data);
        }
    }
</script>
</body>
</html>